<!--<?php print <<<EOT
-->
<div id="breadCrumb">
		<img src="$imgpath/$stylepath/thread/home-old.gif" align="absmiddle" />&nbsp;<a href="$db_bfn" title="$db_bbsname">$db_bbsname</a> &raquo; <a href="search.php">search</a>
</div>
<style type="text/css">
.forum-search{width:680px;margin:20px auto;background:$forumcolortwo;border:1px solid $tdcolor;padding:10px 20px;}
.forum-search table{border:0;}
.s-mb{margin-bottom:1px;}
.forum-search span{padding-right:1em;}
</style>
$db_searchinfo
<form name="sF" action="search.php?#submit" method="post" onSubmit="this.submit.disabled=true;">
<input type="hidden" name="step" value="2" />
<div class="t" style="margin-top:8px;">
	<table width="100%" cellspacing="0" cellpadding="0">
		<tr>
<tr><td class="h" colspan="2">Search</td></tr>
		</tr>
		<tr class="tr2">
			<td colspan="2">&nbsp;</td>
		</tr>
		<tr class="tr3">
			<td colspan="2">
				<div class="forum-search">
					<div style="padding-left:80px;">
					<span class="b f14">keyword</span><input class="input" type="text" id="keyword" name="keyword" value="$skeyword" size="40" style="padding:5px 0 0 2px;height:21px;font-size:14px;" />
					<input class="btn b" type="submit" name="submit" value="Search" style="width:70px;height:27px;font-size:14px;" /> 
					<a style="cursor:pointer;" onclick="showAdvancedSearch();">Multi Search</a>
					</div>
				</div>
				<div class="forum-search" id="advanced_search" style="display:none;">
					<table width="100%" cellspacing="0" cellpadding="0">
						<tr>
							<td class="b">User name</td>
							<td><span><input type="text" name="pwuser" value="$pwuser" class="input"></span></td>
						<tr>
							<td class="b">Keyword matching</td>
							<td>
								<span><input type="radio" name="method" class="s-mb" value="AND" $checked_and/> Exact match (Use ' | 'or space as separator )</span>
								<span><input type="radio" name="method" class="s-mb" value="OR" $checked_or /> Support wildcard *, it is possible to use admi * to match admin</span>		
							</td>
						</tr>
						<tr>
							<td class="b">Search range</td>
							<td>
<!--
EOT;
if($_G[allowsearch]==2 && ($p_table || $t_table)){print <<<EOT
-->
								<span><input type="radio" name="sch_area" value="0" onclick="gettable(this.value);" $checked_0 />Title</span>
								<span><input type="radio" name="sch_area" value="1" onclick="gettable(this.value);" $checked_1/>Title and content</span>
								<span id="ttable" style="display:none;">$t_table</span>
								<span><input type="radio" name="sch_area" value="2" onclick="gettable(this.value);" $checked_2/>Reply title and content</span>
								<span id="ptable" style="display:none;">$p_table</span>
<script language="JavaScript">
var sch_area = '$sch_area';
function gettable(value){
	var ttable = document.getElementById("ttable");
	var ptable = document.getElementById("ptable");
	if (value==2) {
		ptable.style.display = '';
		ttable.style.display = 'none';
	} else if (value==1) {
		ttable.style.display = '';
		ptable.style.display = 'none';
	} else {
		ptable.style.display = 'none';
		ttable.style.display = 'none';
	}
}
if (sch_area == 1 || sch_area == 2) {
	gettable(sch_area);
}
</script>
<!--
EOT;
} else {print <<<EOT
-->	
								<span><input type="radio" name="sch_area" class="s-mb" value="0" checked /> Title</span>
								<span><input type="radio" name="sch_area" class="s-mb" value="1" $disable /> Title and content</span>
								<span><input type="radio" name="sch_area" class="s-mb" value="2" $disable />Reply title and content</span>
<!--
EOT;
}print <<<EOT
-->
								<input type="checkbox" name="digest" class="s-mb" value="1" $checked_disget/>digest
							</td>
						</tr>
						<tr>
							<td class="b">All</td>
							<td>
								<select name="f_fid" >
								<option value="all">All Forum Categories</option>
								$forumcache
<!--
EOT;
if($forumadd){print <<<EOT
-->
								<option value=''>>> Hide forum</option>
								$forumadd
<!--
EOT;
}print <<<EOT
-->
								</select>
							</td>
						</tr>
						<tr>
							<td class="b">Posted Time</td>
							<td>
								<select name="sch_time">
<!--
EOT;
if($_G['schtime'] == 'all'){print <<<EOT
-->
								<option value="all" $time_all>All topics </option>
<!--
EOT;
}print <<<EOT
-->
								<option value="newatc" $time_newatc>New Posts</option>
<!--
EOT;
$schtimedb = array(
'86400' => "<option value=\"86400\" $time_86400>Last 1 Day</option>",
'172800' => "<option value=\"172800\" $time_172800>Last 2 Day</option>",
'604800' => "<option value=\"604800\" $time_604800>Last 1 Week</option>",
'2592000' => "<option value=\"2592000\" $time_2592000>Last 1 Month</option>",
'5184000' => "<option value=\"5184000\" $time_5184000>Last 2 Months</option>",
'7776000' => "<option value=\"7776000\" $time_7776000>Last 3 Months</option>",
'15552000' => "<option value=\"15552000\" $time_15552000>Last 6 Months</option>",
'31536000' => "<option value=\"31536000\" $time_31536000>Last 1 Year</option>"
);
foreach($schtimedb as $key => $value){
if ($_G['schtime'] == 'all' || $key <= $_G['schtime']) {print <<<EOT
-->
$value
<!--
EOT;
}}print <<<EOT
-->
								</select>
							</td>
						</tr>
						<tr>
							<td class="b">Sorting</td>
							<td>
								<span><select name="orderway">
<option value="lastpost" $order_lastpost>Last reply at</option>
<option value="replies" $order_replies> Replies </option>
<option value="hits" $order_hits> Views </option>
								</select></span>
								<span><input type="radio" name="asc" value="ASC" class="s-mb" $asc_ASC /> Ascending</span>
								<input type="radio" name="asc" value="DESC" class="s-mb" $asc_DESC /> Descending
							
							</td>
						</tr>
					</table>
				</div>
			</td>
		</tr>
	</table>
</div>
</form>
<script language="JavaScript">
window.onunload = function(){document.sF.submit.disabled = false;};
function showAdvancedSearch(){
	if (getObj('advanced_search').style.display == 'none'){
		getObj('advanced_search').style.display = '';
	} else {
		getObj('advanced_search').style.display = 'none';
	}
}
</script>
<!--
EOT;
if ($step == 2){print <<<EOT
-->
<div class="t3">$pages</div>
<!--
EOT;
if($admincheck){print <<<EOT
-->
<form action="mawhole.php" method="post">
<input type="hidden" name="fid" value="$seekfid" />
<!--
EOT;
}print <<<EOT
-->
<div class="t">
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td colspan="7" class="h">Threads List</td></tr>
<tr class="tr2 tac">
<td width="5%">Status</td>
<td width="*">Title</td>
<td width="15%">Forum</td>
<td width="13%">Author</td>
<td width="6%"> Replies </td>
<td width="6%"> Views </td>
<td width="20%">Last Post</td>
</tr>
<!--
EOT;
foreach($schdb as $sch){print <<<EOT
-->
<tr class="tr3 tac"><td class="y-style"><img src="$imgpath/$stylepath/thread/$sch[status].gif" border="0"></td>
<th class="y-style" class="tal">
<!--
EOT;
if($admincheck){print <<<EOT
-->
<input type="checkbox" name="tidarray[]" value="$sch[tid]" />
<!--
EOT;
}if($sch['topped']){print <<<EOT
-->
<img src="$imgpath/$stylepath/file/headtopic_$sch[topped].gif" alt="" />
<!--
EOT;
}print <<<EOT
-->
&nbsp;<a href="read.php?tid=$sch[tid]$htmlurl" target="_blank">$sch[subject]</a>
<!--
EOT;
if($sch[digest]){print <<<EOT
-->
<img src="$imgpath/$stylepath/file/digest_$sch[digest].gif" alt="" />
<!--
EOT;
}print <<<EOT
-->
</th>
<td class="y-style">
<a href="thread.php?fid=$sch[fid]">$sch[forumname]</a></td>
<td class="smalltxt y-style"><a href="u.php?action=show&uid=$sch[authorid]">$sch[author]</a><br />$sch[postdate]</td>
<td class="y-style">$sch[replies]</td>
<td class="y-style">$sch[hits]</td>
<td class="y-style">
<a href="read.php?tid=$sch[tid]&page=e#a" target="_blank">
$sch[lastpost]</a>
<br />by: $sch[lastposter]
</tr>
<!--
EOT;
}print <<<EOT
-->
<tr><td style="height:8px;"></td></tr>
</table></div>
<!--
EOT;
if($admincheck){print <<<EOT
-->
<table cellpadding="1" cellspacing="1" align="center" width="$tablewidth">
<tr align="center"><td>
Management Options:
<!--
EOT;
if($isGM || $pwSystem[topped]){print <<<EOT
-->
<input name="action" type="radio" value="headtopic" />Stick
<!--
EOT;
}if($isGM || $pwSystem[typeadmin]){print <<<EOT
-->
<input name="action" type="radio" value="digest" /> Digest 
<input name="action" type="radio" value="lock" />Locked
<input name="action" type="radio" value="edit" />Highligt
<input name="action" type="radio" value="pushtopic" />Move Up
<input name="action" type="radio" value="downtopic" />Move down posts
<!--
EOT;
}if($isGM || $pwSystem[tpccheck]){print <<<EOT
-->
		<input name="action" type="radio" value="type" />Thread category
<!--
EOT;
}if($isGM || $pwSystem[moveatc]){print <<<EOT
-->
		<input name="action" type="radio" value="move" />Move to
<!--
EOT;
}if($isGM || $pwSystem[copyatc]){print <<<EOT
-->
		<input name="action" type="radio" value="copy" />Copy to
<!--
EOT;
}if($isGM || $pwSystem[delatc]){print <<<EOT
-->
		<input name="action" type="radio" value="del" checked />Delete
<!--
EOT;
}print <<<EOT
-->
<br /><br />
<input class="btn" type="button" name="chkall" value="Select All" onclick="CheckAll(this.form)" />
<input class="btn" type="reset" name="Reset" value="reset" />
<input class="btn" type="submit" name="hello" value="Submit" />
</td></tr></table></form>
<!--
EOT;
}print <<<EOT
-->
<div class="fr">Totally {$total} results matched[ {$db_perpage} rows/page]</div>
$pages
<script language="JavaScript">
function CheckAll(form){
	for (var i=0;i<form.elements.length-12;i++){
		var e = form.elements[i];
		e.checked == true ? e.checked = false : e.checked = true;
	}
}
</script>
<!--
EOT;
}?>-->
